using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AutioMgr : MonoBehaviour
{
    private AudioSource[] _Audio=new AudioSource[2];
    private AudioClip BgMusic;
    private AudioClip _OnClickMusic;

    public static AutioMgr Instance;

    public void Awake()
    {
        Instance = this;
        _Audio[0]= this.gameObject.AddComponent<AudioSource>();
        _Audio[1] =this.gameObject.AddComponent<AudioSource>();
        BgMusic = (AudioClip)Resources.Load("Audio/Road_loop");
        _OnClickMusic = (AudioClip) Resources.Load("Audio/button_click");
    }

    private void Start()
    {
       
       
        _mainBgMusicPlay();
    }

    public void _mainBgMusicPlay()
    {
        _Audio[0].clip = BgMusic;
        _Audio[0].loop=true;
        _Audio[0].Play();
    }


    public void OnclickAudio()
    {
        
        _Audio[1].clip = _OnClickMusic;
        _Audio[1].loop=false;
        _Audio[1].Play();
        // if (num==0)
        // {
        //    
        //     num += 1;
        // }
        
    }
}
